<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>Txt2tags User Guide</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1">
<LINK REL="Start" HREF="index.html">
<LINK REL="Contents" HREF="index.html">
<LINK REL="Prev" HREF="TaggedTaggedLineTaggedArea.html">
<LINK REL="Next" HREF="date.html">
<STYLE TYPE="text/css"><!--
BODY { font-family: serif }
H1 { font-family: sans-serif }
H2 { font-family: sans-serif }
H3 { font-family: sans-serif }
H4 { font-family: sans-serif }
H5 { font-family: sans-serif }
H6 { font-family: sans-serif }
SUB { font-size: smaller }
SUP { font-size: smaller }
PRE { font-family: monospace }
--></STYLE>
<LINK REL="stylesheet" TYPE="text/css" HREF="userguide.css"></HEAD>
<BODY>
<A HREF="index.html">Contents</A>
<A HREF="TaggedTaggedLineTaggedArea.html">Previous</A>
<A HREF="date.html">Next</A>
<HR NOSHADE>

<H1><A NAME="7">Part VI - Mastering Macros</A></H1>
<P> Macros are special purpose keywords, that are expanded on conversion
 time. They are used to insert dynamic information, for example the
 current date or information about the document source.</P>
<P> A macro is represented by the <CODE>%%</CODE> chars followed by its
 name, such as <CODE>%%date</CODE>. Some macros do accept an optional
 formatting string inside parenthesis, right after the macro name, such
 as <CODE>%%date(%Y-%m-%d)</CODE>. This format string mixes common text
 with special directives, identified by a percent sign % followed by an
 identification character. If no format string is given, the default
 format is used.</P>
<TABLE ALIGN="center" BORDER="1">
<TR><TH>Macro Name</TH><TH>Expands to...</TH><TH>Default Format</TH></TR>
<TR><TD>%%date</TD><TD>The current date</TD><TD ALIGN="center">%Y%m%d</TD>
</TR>
<TR><TD>%%mtime</TD><TD>The source file modification time</TD><TD ALIGN="center">
%Y%m%d</TD></TR>
<TR><TD>%%infile</TD><TD>The source file path</TD><TD ALIGN="center">%f</TD>
</TR>
<TR><TD>%%outfile</TD><TD>The output file path</TD><TD ALIGN="center">%f</TD>
</TR>
<TR><TD>%%toc</TD><TD>The document TOC (Table of Contents)</TD><TD ALIGN="center">
-</TD></TR>
</TABLE>
<P> General rules:</P>
<UL>
<LI>The macro name is case-insensitive, so <CODE>%%date</CODE>, <CODE>
%%DaTe</CODE> and <CODE>%%DATE</CODE> are identical</LI>
<LI>Macros are valid at the document Header Area and Body Area, except
 %%toc that is valid on Body Area only</LI>
<LI>A macro starts the Body Area if it is found in the Config Area</LI>
<LI>A macro can be placed at any part of the line, including various per
 line (except %%toc, valid when alone in a line)</LI>
<LI>A macro can be used inside links and images marks (except %%toc)</LI>
<LI>Macros are not expanded in Titles, Verbatim, Raw and Tagged Areas</LI>
</UL>
<P> Full example (bold text are expanded macros):</P>
<P> This is the Txt2tags User Guide, converted to<B> html</B> by
 txt2tags from the<B> userguide.t2t</B> source file. The conversion was
 done at<B> 2010-11-04 08:09:04</B>, but the last change on the source
 document was made on<B> 2010-10-31 00:26:16</B>. Both source and
 converted file reside on the<B> userguide</B> directory.</P>
 <A NAME="macro-date"></A><HR NOSHADE>
<A HREF="index.html">Contents</A>
<A HREF="TaggedTaggedLineTaggedArea.html">Previous</A>
<A HREF="date.html">Next</A>
</BODY>
</HTML>
